package com.lxg.learn.dao.order.mapper;

import com.lxg.learn.dao.order.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lxg.learn.vo.OrderVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lxg
 * @since 2025-01-24
 */
public interface OrderMapper extends BaseMapper<Order> {

    @Select({"SELECT o.order_no, SUM(i.price * i.count) AS amount",
            "FROM t_order o JOIN t_order_item i ON o.order_no = i.order_no",
            "GROUP BY o.order_no"})
    List<OrderVo> getOrderAmount();

}

